<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<!-- 公共样式 开始 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/base.css">
	<link rel="stylesheet" type="text/css" href="Resources/css/iconfont.css">
	<script type="text/javascript" src="Resources/framework/jquery-1.11.3.min.js"></script>
	<link rel="stylesheet" type="text/css" href="Resources/layui/css/layui.css">
	<script type="text/javascript" src="Resources/layui/layui.js"></script>
	<!-- 滚动条插件 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/jquery.mCustomScrollbar.css">
	<script src="Resources/framework/jquery-ui-1.10.4.min.js"></script>
	<script src="Resources/framework/jquery.mousewheel.min.js"></script>
	<script src="Resources/framework/jquery.mCustomScrollbar.min.js"></script>
	<script src="Resources/framework/cframe.js"></script><!-- 仅供所有子页面使用 -->
	<!-- 公共样式 结束 -->
	<script type="text/javascript" src="Resources/js/check.js"></script>
<title>用户信息表</title>
</head>
<body>
<div class="cBody">
			<div class="console">
				<form class="layui-form" action="listUser?status=selectlike" method="post">
					<div class="layui-form-item">
						<div class="layui-input-inline">
							<input type="text" name="key" required lay-verify="required" placeholder="输入用户名" autocomplete="off" class="layui-input">
						</div>
						<button class="layui-btn" lay-submit lay-filter="formDemo">用户检索</button>
						<a class="layui-btn" onclick="add();">添加用户</a>
						<a class="layui-btn" onclick="deleteall('listUser?status=deletequery&&ids=');" href="#">批量删除</a>
					</div>
				</form>
			</div>
			
			<table class="layui-table">
				<thead>
					<tr>
						<th></th>
						<th>用户ID</th>
						<th>权限</th>
						<th>用户名</th>
						<th>密码</th>
						<th>性别</th>
						<th>邮箱</th>
						<th>真实名字</th>
						<th>地址</th>
						<th>电话</th>
						<th>余额</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				<c:forEach items="${users}" var="User" varStatus="st">
					<tr>
						<td><input type="checkbox" name="child" value="${User.uid}" onclick="chickchild();"></td>
						<td>${User.uid}</td>
						<td>${User.role.rName}</td>
						<td>${User.uname}</td>
						<td>${User.pwd}</td>
						<td>${User.sex}</td>
						<td>${User.email}</td>
						<td>${User.relName}</td>
						<td>${User.address}</td>
						<td>${User.telephone }</td>
						<td>￥${User.balance}</td>
						<td>
							<button class="layui-btn layui-btn-xs" onclick="updateBut('${User.uid}');">修改</button>
							<button class="layui-btn layui-btn-xs" onclick="location.href='listUser?status=delect&&uid=${User.uid}'">删除</button>
						</td>
					</tr>
				</c:forEach>
				</tbody>
				<thead>
					<tr>
					<td colspan="12">
						<input type="checkbox" id="checkAll" name="checkAll" onclick="selectAll();">全选&emsp;&emsp;
						<input type="checkbox" id="recheck" onclick="notSelectAll()">反选
						<div align="center">
							<a href="listUser?status=selectpage&start=0">首页</a>&emsp;
							<a href="listUser?status=selectpage&start=${prePage}">前一页</a>&emsp;
							<a href="listUser?status=selectpage&start=${nextPage}">后一页</a>&emsp;
							<a href="listUser?status=selectpage&start=${totalPage-1}">尾页</a>&emsp;
						</div>
					</td>
				</tr>
				<tr><td colspan="12" align="center">当前页: ${star+1}&emsp;总页数：${totalPage}&emsp;总记录：${totalsize}</td></tr>
				</thead>
			</table>
			
			<!-- layUI 分页模块 -->
			<div id="pages"></div>
			<script>
				
				//添加
				function add(){
					layui.use('layer', function() {
						var layer = layui.layer;
						
						//iframe层-父子操作
						layer.open({
							type: 2,
							area: ['70%', '60%'],
							fixed: false, //不固定
							maxmin: true,
							content: 'listUser?status=addjsp'
						});
					});
				}
				//修改按钮
				var updateFrame = null;
				function updateBut(uid){
					layui.use('layer', function() {
						var layer = layui.layer;
							
						//iframe层-父子操作
						updateFrame = layer.open({
                    		title: "用户信息修改",
							type: 2,
							area: ['70%', '60%'],
							scrollbar: false,	//默认：true,默认允许浏览器滚动，如果设定scrollbar: false，则屏蔽
							maxmin: true,
							content: 'listUser?status=userinfo&&uid=' + uid
						});
					});
				}
			</script>
		</div>
</body>
</html>